#ifndef _KRAW_D3D9DISPLAY_H_
#define _KRAW_D3D9DISPLAY_H_
/**
    DirectX9-implementation of 3D classes
*/
#include "kraw.h"

#include <Windows.h>
#include <mmsystem.h>
#include <d3d9.h>
#include <d3dx9.h>

namespace Kraw
{
/**
A display implemented using a Direct3D9 device on win32
*/
class D3D9Shader;
class D3D9Display : public Display
{
public:
	D3D9Display();
    ~D3D9Display();

	bool OpenWindow();
	void CloseWindow();
    void OnWindowDestroy();
	
	void InitTransforms();
    void SetTransforms();

	matrix44 matTransform[Display::Max_TransformTypes];
    //int dirtyTransformTypes;//TODO-

    //shaders
    D3D9Shader* LoadVertexShader( const char* filename, const char* function );
    void SetShader( D3D9Shader* pShader );
	void SetShaderTransform( const char* name, const matrix44& mat );

	D3D9Shader* pCurShader;

    //private members
	static int numDisplays;
	HWND hWnd;
	IDirect3DDevice9 *pD3D9Device;
    D3DPRESENT_PARAMETERS presentParams;

	//transforms
	D3DXMATRIXA16 matWorld;
	D3DXMATRIXA16 matView;
	D3DXMATRIXA16 matProj;
};

} //namespace Kraw

#endif //_KRAW_D3D9DISPLAY_H_
